package com.huawei.appgallery.festivalanimation.particle.initializers;

import com.huawei.appgallery.festivalanimation.particle.Particle;
import com.huawei.appgallery.festivalanimation.particle.utils.RandomUtil;

public class AccelerationInitializer implements IParticleInitializer {
    private int mMaxAngle;
    private float mMaxValue;
    private int mMinAngle;
    private float mMinValue;

    public AccelerationInitializer(float f, float f2, int i, int i2) {
        this.mMinValue = f;
        this.mMaxValue = f2;
        this.mMinAngle = i;
        this.mMaxAngle = i2;
    }

    public void initParticle(Particle particle) {
        float f = (float) this.mMinAngle;
        if (this.mMaxAngle != this.mMinAngle) {
            f = (float) (RandomUtil.nextInt(this.mMaxAngle - this.mMinAngle) + this.mMinAngle);
        }
        f = (float) ((((double) f) * 3.141592653589793d) / 180.0d);
        float nextFloat = RandomUtil.nextFloat(this.mMaxValue - this.mMinValue) + this.mMinValue;
        particle.mAccelerationX = (float) (((double) nextFloat) * Math.cos((double) f));
        particle.mAccelerationY = (float) (Math.sin((double) f) * ((double) nextFloat));
    }
}
